/*
*今日头条
 */
import React from 'react'
import  {Carousel} from 'antd-mobile'
import './TodayNews.css'
import  icon from './icon.png'

class TodayNews extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            TodayNews:[]
        };
    }
    componentWillReceiveProps(nextProps){
         if(nextProps.TodayNews.length>1){
             this.setState({
                 TodayNews: nextProps.TodayNews
             });
         }
    }
    render() {
        let TodayNews_item={
            height:'0.9rem',
            lineHeight:'0.9rem',
            overFlow:'hidden'
        }
        return (
            <div className="TodayNews_content">
                <div className="TodayNews_logo">
                     <img src={icon}/>
                </div>
                <div className="TodayNews_txt">
                    <span></span>
                    <Carousel style={TodayNews_item}
                              vertical
                              dots={false}
                              dragging={false}
                              swiping={false}
                              autoplay
                              infinite
                    >
                            {this.state.TodayNews.map(item => (
                                <div style={TodayNews_item} key={item}><p>{item.class_name}</p></div>
                            ))}
                    </Carousel>
                    {/*<p>全优丰汇“创业合伙人”计划正式发布</p>*/}
                </div>
            </div>
        )
    }
}


export default TodayNews